﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xant.FlowEngine.Core;
using Xant.FlowEngine.Interface;
using Xant.FlowEngine.Serialize;

namespace Xant.FlowEngine.Extend
{
    public sealed class ExtendSerializer : AbstractSerializer
    {
        public override T Load<T>(IDbConnection conn, int id, ref bool handled)
        {
            return base.Load<T>(conn, id, ref handled);
        }

        public override void Insert<T>(IDbTransaction trans, T item, ref bool handled)
        {
            if(typeof(T)==typeof(MessageActivity))
            {
                base.Insert(trans, item, ref handled);
                item.Id = Guid.Empty;
                handled = true;
            }
        }

        public override void Update<T>(IDbTransaction trans, T item, ref bool handled)
        {
        }

        public override void Delete<T>(IDbTransaction trans, T item, ref bool handled)
        {
        }

        public override void DeleteById<T>(IDbTransaction trans, int id, ref bool handled)
        {
        }
    }
}
